package geez.widget;

import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.user.client.ui.ClickListener;
import com.google.gwt.user.client.ui.Hyperlink;

import static geez.widget.Geez.withStyle;

public class GHyperlink extends Hyperlink implements GClickable, GTextSetable {
    public GHyperlink text(String text) {
        setText(text);
        return this;
    }

    public GHyperlink id(String id) {
        Geez.withNameAndId(this, id);
        return this;
    }

    public GHyperlink css(String cssClass, String... optionalClasses) {
        withStyle(this, cssClass, optionalClasses);
        return this;
    }

    public GHyperlink show() {
        setVisible(true);
        return this;
    }

    public GHyperlink hide() {
        setVisible(false);
        return this;
    }

    @Deprecated
    public GHyperlink withClickListener(ClickListener listener) {
        addClickListener(listener);
        return this;
    }

    public GHyperlink add(ClickHandler handler) {
        addClickHandler(handler);
        return this;
    }
}
